package org.fxcontainer.structure
{
	import mx.containers.Box;
	
	/**
	 * The base class for IPage implementation. <br/>
	 * Provides base page methods.
	 * @author Izzet_Mustafayev
	 */
	public class AbstractPage extends Box implements IPage
	{	
		/**
		 * The page name. 
		 */
		private var _pageName:String;
		
		/**
		 * The page title. 
		 */
		private var _pageTitle:String;
		
		/**
		 * The <code>IPage</code> constructor. 
		 */
		public function AbstractPage()
		{
			super();
			this.visible = false;
		}
		
		/**
		 * General implementation, retrieves the page name. 
		 * @return the page name
		 */
		public function pageName():String
		{	
			if(null == _pageName){
				throw new Error("The AbstractPage.pageName() method was not overriden by the implementing class.");
			}
			return _pageName;
		}
		
		/**
		 * The page name setter. 
		 * @param name the page name to set.
		 */
		public function set pagename(name:String):void
		{
			this._pageName = name;
			this.name = name; 
		}
		
		private var _default:Boolean = false;
		
		public function isDefault():Boolean
		{
			return this._default;
		}
		
		/**
		 * Makes page default. 
		 * @param isDefault the page mode status value
		 */
		public function set setDefault(isDefault:Boolean):void
		{
			this._default = isDefault;
		}
		
		/**
		 * Activate page.
		 */
		public function activate():void
		{
			this.visible = true;
		}
		
		/**
		 * Deactivate page.
		 */
		public function deActivate():void
		{
			this.visible = false;
		}
		
		public function pageTitle():String
		{
			return this._pageTitle;
		}
		
		public function set pagetitle(title:String):void
		{
			this._pageTitle = title;
		}
	}
}